package main

import (
	"database/sql"
	"fmt"
	"os"

	_ "gitee.com/GBase8s/go-gci"
)

func main() {
	if len(os.Args) != 2 {
		fmt.Printf("ERROR: Please provide a DSN string in ONE argument:\n\n")
		os.Exit(1)
	}
	os.Setenv("NLS_LANG", "")

	db, err := sql.Open("gbase8s", os.Args[1])
	if err != nil {
		fmt.Println(err)
		return
	}
	defer db.Close()
	fmt.Println()
	var user string
	err = db.QueryRow("select user from dual").Scan(&user)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("Successful 'as sysdba' connection. Current user is: %v\n", user)
}
